package cn.ibizlab.odoo.core.odoo_asset.service.impl;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.util.Collection;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import cn.ibizlab.odoo.core.client.model.Iasset_asset;
import cn.ibizlab.odoo.core.odoo_asset.domain.Asset_asset;
import cn.ibizlab.odoo.core.odoo_asset.filter.Asset_assetSearchContext;
import cn.ibizlab.odoo.core.odoo_asset.service.IAsset_assetService;
import cn.ibizlab.odoo.util.SearchResult;
import cn.ibizlab.odoo.util.log.IBIZLog;

/**
 * 实体[Asset] 服务对象接口实现
 */
@Slf4j
@IBIZLog
@Service
public class Asset_assetServiceImpl implements IAsset_assetService {

    @Autowired
    private cn.ibizlab.odoo.core.client.service.Iasset_assetClientService asset_assetClientService;

    @Override
    public boolean update(Asset_asset asset_asset) {
        boolean bOk = false ;
        Iasset_asset clientModel = this.convert2Model(asset_asset,null);
        asset_assetClientService.update(clientModel) ;
        this.convert2Domain(clientModel,asset_asset) ;
        bOk = true;
        return bOk ;
    }

    @Override
    public Asset_asset get(Integer id) {
        Iasset_asset clientModel = asset_assetClientService.createModel();
        clientModel.setId(id);
        asset_assetClientService.get(clientModel) ;
        return this.convert2Domain(clientModel,null);
    }

    @Override
    public Asset_asset get(Asset_asset asset_asset) {
        Asset_asset retasset_asset = this.get(asset_asset.getId()) ;
    	BeanCopier copier=BeanCopier.create(retasset_asset.getClass(), asset_asset.getClass(), false);
        copier.copy(retasset_asset, asset_asset, null);
        return asset_asset ;
    }

    @Override
    public boolean remove(Integer id) {
        boolean bOk = false ;
        Iasset_asset clientModel = asset_assetClientService.createModel();
        clientModel.setId(id);
        asset_assetClientService.remove(clientModel) ;
        bOk = true ;
        return bOk ;
    }

    @Override
    public void removeBatch(Collection<? extends Serializable> idList, int batchSize) {

        //asset_assetClientService.removeBatch(asset_assets) ;

    }

    @Override
    public void createBatch(List<Asset_asset> asset_assets, int batchSize) {

                        //asset_assetClientService.createBatch(asset_assets,batchSize) ;

    }

    @Override
    public boolean create(Asset_asset asset_asset) {
        boolean bOk = false ;
        Iasset_asset clientModel = this.convert2Model(asset_asset,null);
        asset_assetClientService.create(clientModel) ;
        this.convert2Domain(clientModel,asset_asset);
        bOk = true ;

        return bOk ;
    }

    @Override
    public void updateBatch(List<Asset_asset> asset_assets, int batchSize) {

        //asset_assetClientService.updateBatch(asset_assets,batchSize) ;

    }

    /**
     * 查询集合 默认查询
     */
    @Override
    public Page<Asset_asset> searchDefault(Asset_assetSearchContext context) {
        List<Asset_asset> list = new ArrayList<Asset_asset>();
        Page<cn.ibizlab.odoo.core.client.model.Iasset_asset> clientModelList = asset_assetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iasset_asset clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Asset_asset>(list, context.getPageable(), clientModelList.getTotalElements());
    }


    /**
     * 根据State of Asset查询
     */
    @Override
    public Page<Asset_asset> selectByOdoo_accounting_state(Integer id){
        Asset_assetSearchContext context = new Asset_assetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Asset_asset> list = new ArrayList<Asset_asset>();
        Page<cn.ibizlab.odoo.core.client.model.Iasset_asset> clientModelList = asset_assetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iasset_asset clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Asset_asset>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据State of Asset查询
     */
    @Override
    public Page<Asset_asset> selectByOdoo_finance_state(Integer id){
        Asset_assetSearchContext context = new Asset_assetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Asset_asset> list = new ArrayList<Asset_asset>();
        Page<cn.ibizlab.odoo.core.client.model.Iasset_asset> clientModelList = asset_assetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iasset_asset clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Asset_asset>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据State of Asset查询
     */
    @Override
    public Page<Asset_asset> selectByOdoo_maintenance_state(Integer id){
        Asset_assetSearchContext context = new Asset_assetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Asset_asset> list = new ArrayList<Asset_asset>();
        Page<cn.ibizlab.odoo.core.client.model.Iasset_asset> clientModelList = asset_assetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iasset_asset clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Asset_asset>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据State of Asset查询
     */
    @Override
    public Page<Asset_asset> selectByOdoo_manufacture_state(Integer id){
        Asset_assetSearchContext context = new Asset_assetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Asset_asset> list = new ArrayList<Asset_asset>();
        Page<cn.ibizlab.odoo.core.client.model.Iasset_asset> clientModelList = asset_assetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iasset_asset clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Asset_asset>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据State of Asset查询
     */
    @Override
    public Page<Asset_asset> selectByOdoo_warehouse_state(Integer id){
        Asset_assetSearchContext context = new Asset_assetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Asset_asset> list = new ArrayList<Asset_asset>();
        Page<cn.ibizlab.odoo.core.client.model.Iasset_asset> clientModelList = asset_assetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iasset_asset clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Asset_asset>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Asset_asset> selectByOdoo_manufacturer(Integer id){
        Asset_assetSearchContext context = new Asset_assetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Asset_asset> list = new ArrayList<Asset_asset>();
        Page<cn.ibizlab.odoo.core.client.model.Iasset_asset> clientModelList = asset_assetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iasset_asset clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Asset_asset>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Asset_asset> selectByOdoo_vendor(Integer id){
        Asset_assetSearchContext context = new Asset_assetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Asset_asset> list = new ArrayList<Asset_asset>();
        Page<cn.ibizlab.odoo.core.client.model.Iasset_asset> clientModelList = asset_assetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iasset_asset clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Asset_asset>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Asset_asset> selectByOdoo_create(Integer id){
        Asset_assetSearchContext context = new Asset_assetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Asset_asset> list = new ArrayList<Asset_asset>();
        Page<cn.ibizlab.odoo.core.client.model.Iasset_asset> clientModelList = asset_assetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iasset_asset clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Asset_asset>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Asset_asset> selectByOdoo_user(Integer id){
        Asset_assetSearchContext context = new Asset_assetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Asset_asset> list = new ArrayList<Asset_asset>();
        Page<cn.ibizlab.odoo.core.client.model.Iasset_asset> clientModelList = asset_assetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iasset_asset clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Asset_asset>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Asset_asset> selectByOdoo_write(Integer id){
        Asset_assetSearchContext context = new Asset_assetSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Asset_asset> list = new ArrayList<Asset_asset>();
        Page<cn.ibizlab.odoo.core.client.model.Iasset_asset> clientModelList = asset_assetClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iasset_asset clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Asset_asset>(list, context.getPageable(), clientModelList.getTotalElements());

    }



    public Iasset_asset convert2Model(Asset_asset domain , Iasset_asset model) {
        if(domain == null)
            return model ;
        if(model==null){
            model = asset_assetClientService.createModel() ;
        }

         if(domain.getPositionDirtyFlag())
            model.setPosition(domain.getPosition());
         if(domain.getMeter_idsDirtyFlag())
            model.setMeter_ids(domain.getMeter_ids());
         if(domain.getMessage_attachment_countDirtyFlag())
            model.setMessage_attachment_count(domain.getMessage_attachment_count());
         if(domain.getStart_dateDirtyFlag())
            model.setStart_date(domain.getStart_date());
         if(domain.getMaintenance_dateDirtyFlag())
            model.setMaintenance_date(domain.getMaintenance_date());
         if(domain.getImageDirtyFlag())
            model.setImage(domain.getImage());
         if(domain.getProperty_stock_assetDirtyFlag())
            model.setProperty_stock_asset(domain.getProperty_stock_asset());
         if(domain.getMessage_channel_idsDirtyFlag())
            model.setMessage_channel_ids(domain.getMessage_channel_ids());
         if(domain.getModelDirtyFlag())
            model.setModel(domain.getModel());
         if(domain.getAsset_numberDirtyFlag())
            model.setAsset_number(domain.getAsset_number());
         if(domain.getMessage_unreadDirtyFlag())
            model.setMessage_unread(domain.getMessage_unread());
         if(domain.getMessage_main_attachment_idDirtyFlag())
            model.setMessage_main_attachment_id(domain.getMessage_main_attachment_id());
         if(domain.getSerialDirtyFlag())
            model.setSerial(domain.getSerial());
         if(domain.getMessage_has_error_counterDirtyFlag())
            model.setMessage_has_error_counter(domain.getMessage_has_error_counter());
         if(domain.getMessage_has_errorDirtyFlag())
            model.setMessage_has_error(domain.getMessage_has_error());
         if(domain.getMessage_partner_idsDirtyFlag())
            model.setMessage_partner_ids(domain.getMessage_partner_ids());
         if(domain.getActiveDirtyFlag())
            model.setActive(domain.getActive());
         if(domain.getMessage_follower_idsDirtyFlag())
            model.setMessage_follower_ids(domain.getMessage_follower_ids());
         if(domain.getWrite_dateDirtyFlag())
            model.setWrite_date(domain.getWrite_date());
         if(domain.getMessage_needaction_counterDirtyFlag())
            model.setMessage_needaction_counter(domain.getMessage_needaction_counter());
         if(domain.getPurchase_dateDirtyFlag())
            model.setPurchase_date(domain.getPurchase_date());
         if(domain.getImage_mediumDirtyFlag())
            model.setImage_medium(domain.getImage_medium());
         if(domain.getDisplay_nameDirtyFlag())
            model.setDisplay_name(domain.getDisplay_name());
         if(domain.getIdDirtyFlag())
            model.setId(domain.getId());
         if(domain.getCategory_idsDirtyFlag())
            model.setCategory_ids(domain.getCategory_ids());
         if(domain.getWarranty_start_dateDirtyFlag())
            model.setWarranty_start_date(domain.getWarranty_start_date());
         if(domain.getMessage_unread_counterDirtyFlag())
            model.setMessage_unread_counter(domain.getMessage_unread_counter());
         if(domain.getCreate_dateDirtyFlag())
            model.setCreate_date(domain.getCreate_date());
         if(domain.getWarranty_end_dateDirtyFlag())
            model.setWarranty_end_date(domain.getWarranty_end_date());
         if(domain.getWebsite_message_idsDirtyFlag())
            model.setWebsite_message_ids(domain.getWebsite_message_ids());
         if(domain.getImage_smallDirtyFlag())
            model.setImage_small(domain.getImage_small());
         if(domain.getNameDirtyFlag())
            model.setName(domain.getName());
         if(domain.getCriticalityDirtyFlag())
            model.setCriticality(domain.getCriticality());
         if(domain.getMessage_idsDirtyFlag())
            model.setMessage_ids(domain.getMessage_ids());
         if(domain.getMessage_needactionDirtyFlag())
            model.setMessage_needaction(domain.getMessage_needaction());
         if(domain.get__last_updateDirtyFlag())
            model.set__last_update(domain.get__last_update());
         if(domain.getMro_countDirtyFlag())
            model.setMro_count(domain.getMro_count());
         if(domain.getMessage_is_followerDirtyFlag())
            model.setMessage_is_follower(domain.getMessage_is_follower());
         if(domain.getWarehouse_state_id_textDirtyFlag())
            model.setWarehouse_state_id_text(domain.getWarehouse_state_id_text());
         if(domain.getUser_id_textDirtyFlag())
            model.setUser_id_text(domain.getUser_id_text());
         if(domain.getCreate_uid_textDirtyFlag())
            model.setCreate_uid_text(domain.getCreate_uid_text());
         if(domain.getMaintenance_state_colorDirtyFlag())
            model.setMaintenance_state_color(domain.getMaintenance_state_color());
         if(domain.getAccounting_state_id_textDirtyFlag())
            model.setAccounting_state_id_text(domain.getAccounting_state_id_text());
         if(domain.getManufacture_state_id_textDirtyFlag())
            model.setManufacture_state_id_text(domain.getManufacture_state_id_text());
         if(domain.getFinance_state_id_textDirtyFlag())
            model.setFinance_state_id_text(domain.getFinance_state_id_text());
         if(domain.getMaintenance_state_id_textDirtyFlag())
            model.setMaintenance_state_id_text(domain.getMaintenance_state_id_text());
         if(domain.getManufacturer_id_textDirtyFlag())
            model.setManufacturer_id_text(domain.getManufacturer_id_text());
         if(domain.getWrite_uid_textDirtyFlag())
            model.setWrite_uid_text(domain.getWrite_uid_text());
         if(domain.getVendor_id_textDirtyFlag())
            model.setVendor_id_text(domain.getVendor_id_text());
         if(domain.getManufacture_state_idDirtyFlag())
            model.setManufacture_state_id(domain.getManufacture_state_id());
         if(domain.getAccounting_state_idDirtyFlag())
            model.setAccounting_state_id(domain.getAccounting_state_id());
         if(domain.getCreate_uidDirtyFlag())
            model.setCreate_uid(domain.getCreate_uid());
         if(domain.getVendor_idDirtyFlag())
            model.setVendor_id(domain.getVendor_id());
         if(domain.getWarehouse_state_idDirtyFlag())
            model.setWarehouse_state_id(domain.getWarehouse_state_id());
         if(domain.getWrite_uidDirtyFlag())
            model.setWrite_uid(domain.getWrite_uid());
         if(domain.getUser_idDirtyFlag())
            model.setUser_id(domain.getUser_id());
         if(domain.getFinance_state_idDirtyFlag())
            model.setFinance_state_id(domain.getFinance_state_id());
         if(domain.getMaintenance_state_idDirtyFlag())
            model.setMaintenance_state_id(domain.getMaintenance_state_id());
         if(domain.getManufacturer_idDirtyFlag())
            model.setManufacturer_id(domain.getManufacturer_id());
        return model ;
    }

    public Asset_asset convert2Domain( Iasset_asset model ,Asset_asset domain) {
        if(model == null)
            return domain ;
        if(domain == null){
            domain = new Asset_asset();
        }

        if(model.getPositionDirtyFlag())
            domain.setPosition(model.getPosition());
        if(model.getMeter_idsDirtyFlag())
            domain.setMeter_ids(model.getMeter_ids());
        if(model.getMessage_attachment_countDirtyFlag())
            domain.setMessage_attachment_count(model.getMessage_attachment_count());
        if(model.getStart_dateDirtyFlag())
            domain.setStart_date(model.getStart_date());
        if(model.getMaintenance_dateDirtyFlag())
            domain.setMaintenance_date(model.getMaintenance_date());
        if(model.getImageDirtyFlag())
            domain.setImage(model.getImage());
        if(model.getProperty_stock_assetDirtyFlag())
            domain.setProperty_stock_asset(model.getProperty_stock_asset());
        if(model.getMessage_channel_idsDirtyFlag())
            domain.setMessage_channel_ids(model.getMessage_channel_ids());
        if(model.getModelDirtyFlag())
            domain.setModel(model.getModel());
        if(model.getAsset_numberDirtyFlag())
            domain.setAsset_number(model.getAsset_number());
        if(model.getMessage_unreadDirtyFlag())
            domain.setMessage_unread(model.getMessage_unread());
        if(model.getMessage_main_attachment_idDirtyFlag())
            domain.setMessage_main_attachment_id(model.getMessage_main_attachment_id());
        if(model.getSerialDirtyFlag())
            domain.setSerial(model.getSerial());
        if(model.getMessage_has_error_counterDirtyFlag())
            domain.setMessage_has_error_counter(model.getMessage_has_error_counter());
        if(model.getMessage_has_errorDirtyFlag())
            domain.setMessage_has_error(model.getMessage_has_error());
        if(model.getMessage_partner_idsDirtyFlag())
            domain.setMessage_partner_ids(model.getMessage_partner_ids());
        if(model.getActiveDirtyFlag())
            domain.setActive(model.getActive());
        if(model.getMessage_follower_idsDirtyFlag())
            domain.setMessage_follower_ids(model.getMessage_follower_ids());
        if(model.getWrite_dateDirtyFlag())
            domain.setWrite_date(model.getWrite_date());
        if(model.getMessage_needaction_counterDirtyFlag())
            domain.setMessage_needaction_counter(model.getMessage_needaction_counter());
        if(model.getPurchase_dateDirtyFlag())
            domain.setPurchase_date(model.getPurchase_date());
        if(model.getImage_mediumDirtyFlag())
            domain.setImage_medium(model.getImage_medium());
        if(model.getDisplay_nameDirtyFlag())
            domain.setDisplay_name(model.getDisplay_name());
        if(model.getIdDirtyFlag())
            domain.setId(model.getId());
        if(model.getCategory_idsDirtyFlag())
            domain.setCategory_ids(model.getCategory_ids());
        if(model.getWarranty_start_dateDirtyFlag())
            domain.setWarranty_start_date(model.getWarranty_start_date());
        if(model.getMessage_unread_counterDirtyFlag())
            domain.setMessage_unread_counter(model.getMessage_unread_counter());
        if(model.getCreate_dateDirtyFlag())
            domain.setCreate_date(model.getCreate_date());
        if(model.getWarranty_end_dateDirtyFlag())
            domain.setWarranty_end_date(model.getWarranty_end_date());
        if(model.getWebsite_message_idsDirtyFlag())
            domain.setWebsite_message_ids(model.getWebsite_message_ids());
        if(model.getImage_smallDirtyFlag())
            domain.setImage_small(model.getImage_small());
        if(model.getNameDirtyFlag())
            domain.setName(model.getName());
        if(model.getCriticalityDirtyFlag())
            domain.setCriticality(model.getCriticality());
        if(model.getMessage_idsDirtyFlag())
            domain.setMessage_ids(model.getMessage_ids());
        if(model.getMessage_needactionDirtyFlag())
            domain.setMessage_needaction(model.getMessage_needaction());
        if(model.get__last_updateDirtyFlag())
            domain.set__last_update(model.get__last_update());
        if(model.getMro_countDirtyFlag())
            domain.setMro_count(model.getMro_count());
        if(model.getMessage_is_followerDirtyFlag())
            domain.setMessage_is_follower(model.getMessage_is_follower());
        if(model.getWarehouse_state_id_textDirtyFlag())
            domain.setWarehouse_state_id_text(model.getWarehouse_state_id_text());
        if(model.getUser_id_textDirtyFlag())
            domain.setUser_id_text(model.getUser_id_text());
        if(model.getCreate_uid_textDirtyFlag())
            domain.setCreate_uid_text(model.getCreate_uid_text());
        if(model.getMaintenance_state_colorDirtyFlag())
            domain.setMaintenance_state_color(model.getMaintenance_state_color());
        if(model.getAccounting_state_id_textDirtyFlag())
            domain.setAccounting_state_id_text(model.getAccounting_state_id_text());
        if(model.getManufacture_state_id_textDirtyFlag())
            domain.setManufacture_state_id_text(model.getManufacture_state_id_text());
        if(model.getFinance_state_id_textDirtyFlag())
            domain.setFinance_state_id_text(model.getFinance_state_id_text());
        if(model.getMaintenance_state_id_textDirtyFlag())
            domain.setMaintenance_state_id_text(model.getMaintenance_state_id_text());
        if(model.getManufacturer_id_textDirtyFlag())
            domain.setManufacturer_id_text(model.getManufacturer_id_text());
        if(model.getWrite_uid_textDirtyFlag())
            domain.setWrite_uid_text(model.getWrite_uid_text());
        if(model.getVendor_id_textDirtyFlag())
            domain.setVendor_id_text(model.getVendor_id_text());
        if(model.getManufacture_state_idDirtyFlag())
            domain.setManufacture_state_id(model.getManufacture_state_id());
        if(model.getAccounting_state_idDirtyFlag())
            domain.setAccounting_state_id(model.getAccounting_state_id());
        if(model.getCreate_uidDirtyFlag())
            domain.setCreate_uid(model.getCreate_uid());
        if(model.getVendor_idDirtyFlag())
            domain.setVendor_id(model.getVendor_id());
        if(model.getWarehouse_state_idDirtyFlag())
            domain.setWarehouse_state_id(model.getWarehouse_state_id());
        if(model.getWrite_uidDirtyFlag())
            domain.setWrite_uid(model.getWrite_uid());
        if(model.getUser_idDirtyFlag())
            domain.setUser_id(model.getUser_id());
        if(model.getFinance_state_idDirtyFlag())
            domain.setFinance_state_id(model.getFinance_state_id());
        if(model.getMaintenance_state_idDirtyFlag())
            domain.setMaintenance_state_id(model.getMaintenance_state_id());
        if(model.getManufacturer_idDirtyFlag())
            domain.setManufacturer_id(model.getManufacturer_id());
        return domain ;
    }


}
